<?php
    // 接受前端发送过来的数据
    $id = $_GET["id"];

    // 链接数据库
    $conn = mysqli_connect("localhost", "root", "123456", "sbeam");
    // 查询
    $result = mysqli_query($conn, "SELECT * FROM detail where slug='$id'");
    // 判断有没有查询到内容
    // $info = mysqli_num_rows($result);
    $info = mysqli_fetch_assoc($result);
    
    echo json_encode(array("error" => 0, "data" => $info));

?>